package com.ruoyi.web.controller.talentServerController;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TalCuptureNotice;
import com.ruoyi.system.service.ITalCuptureNoticeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 党费收缴通知Controller
 *
 * @author anxinm
 * @date 2024-04-07
 */
@RestController
@RequestMapping("/system/cupture_notice")
public class TalCuptureNoticeController extends BaseController
{
    @Autowired
    private ITalCuptureNoticeService talCuptureNoticeService;

    /**
     * 查询党费收缴通知列表
     */
    @PreAuthorize("@ss.hasPermi('system:cupture_notice:list')")
    @GetMapping("/list")
    public TableDataInfo list(TalCuptureNotice talCuptureNotice)
    {
        startPage();
        List<TalCuptureNotice> list = talCuptureNoticeService.selectTalCuptureNoticeList(talCuptureNotice);
        return getDataTable(list);
    }

    /**
     * 导出党费收缴通知列表
     */
    @PreAuthorize("@ss.hasPermi('system:cupture_notice:export')")
    @Log(title = "党费收缴通知", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TalCuptureNotice talCuptureNotice)
    {
        List<TalCuptureNotice> list = talCuptureNoticeService.selectTalCuptureNoticeList(talCuptureNotice);
        ExcelUtil<TalCuptureNotice> util = new ExcelUtil<TalCuptureNotice>(TalCuptureNotice.class);
        util.exportExcel(response, list, "党费收缴通知数据");
    }

    /**
     * 获取党费收缴通知详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:cupture_notice:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(talCuptureNoticeService.selectTalCuptureNoticeById(id));
    }

    /**
     * 新增党费收缴通知
     */
    @PreAuthorize("@ss.hasPermi('system:cupture_notice:add')")
    @Log(title = "党费收缴通知", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TalCuptureNotice talCuptureNotice)
    {
        return toAjax(talCuptureNoticeService.insertTalCuptureNotice(talCuptureNotice));
    }

    /**
     * 修改党费收缴通知
     */
    @PreAuthorize("@ss.hasPermi('system:cupture_notice:edit')")
    @Log(title = "党费收缴通知", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TalCuptureNotice talCuptureNotice)
    {
        return toAjax(talCuptureNoticeService.updateTalCuptureNotice(talCuptureNotice));
    }

    /**
     * 删除党费收缴通知
     */
    @PreAuthorize("@ss.hasPermi('system:cupture_notice:remove')")
    @Log(title = "党费收缴通知", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(talCuptureNoticeService.deleteTalCuptureNoticeByIds(ids));
    }

    @GetMapping("/getNoticeList")
    public AjaxResult getNoticeList(){
        List<TalCuptureNotice> list = talCuptureNoticeService.list();
        return success(list) ;
    }
}
